Keep track of cursor position also in root window coordinates. Prune out
authorTor Lillqvist <tml@novell.com>
Fri, 2 Sep 2005 01:54:45 +0000 (01:54 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 2 Sep 2005 01:54:45 +0000 (01:54 +0000)
2005-09-02  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkevents-win32.c (gdk_event_translate): Keep track of
cursor position also in root window coordinates. Prune out
superfluous WM_MOUSEMOVE messages even earlier, based on root window
coordinates. Windows sends WM_MOUSEMOVE messages after a new
window has ben mapped below the cursor even if the mouse doesn't
move. We used to generate GDK_MOTION_NOTIFY in these cases. This
confused at least gtk_menu_motion_notify(). (#314995)

* gtk/gtkintl.h: No need to include config.h here. It caused
warnings about GTK_LOCALEDIR being redefined on Win32 when
compiling files where gtkintl.h is included after gtkprivate.h
(which #undefines and re-#defines GTK_LOCALEDIR on Win32).

* gtk/gtkplug.c: Include config.h.

ChangeLog
ChangeLog.pre-2-10
gdk/win32/gdkevents-win32.c
gtk/gtkintl.h
gtk/gtkplug.c

index 129fbb0cb6d2c47ff5ddc31c15263ac56960afef..bb88c89fcaaa4e9d76d012941b78dfcc2cba9893 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-09-02  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkevents-win32.c (gdk_event_translate): Keep track of
+       cursor position also in root window coordinates. Prune out
+       superfluous WM_MOUSEMOVE events even earlier, based on root window
+       coordinates. Windows sends WM_MOUSEMOVE messages after a new
+       window has ben mapped below the cursor even if the mouse doesn't
+       move. We used to generate GDK_MOTION_NOTIFY in these cases. This
+       confused at least gtk_menu_motion_notify(). (#314995)
+
+       * gtk/gtkintl.h: No need to include config.h here. It caused
+       warnings about GTK_LOCALEDIR being redefined on Win32 when
+       compiling files where gtkintl.h is included after gtkprivate.h
+       (which #undefines and re-#defines GTK_LOCALEDIR on Win32).
+
+       * gtk/gtkplug.c: Include config.h.
+
 2005-09-01  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkfilesystemunix.c: Pass statbufs down to 
index 129fbb0cb6d2c47ff5ddc31c15263ac56960afef..bb88c89fcaaa4e9d76d012941b78dfcc2cba9893 100644 (file)
@@ -1,3 +1,20 @@
+2005-09-02  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkevents-win32.c (gdk_event_translate): Keep track of
+       cursor position also in root window coordinates. Prune out
+       superfluous WM_MOUSEMOVE events even earlier, based on root window
+       coordinates. Windows sends WM_MOUSEMOVE messages after a new
+       window has ben mapped below the cursor even if the mouse doesn't
+       move. We used to generate GDK_MOTION_NOTIFY in these cases. This
+       confused at least gtk_menu_motion_notify(). (#314995)
+
+       * gtk/gtkintl.h: No need to include config.h here. It caused
+       warnings about GTK_LOCALEDIR being redefined on Win32 when
+       compiling files where gtkintl.h is included after gtkprivate.h
+       (which #undefines and re-#defines GTK_LOCALEDIR on Win32).
+
+       * gtk/gtkplug.c: Include config.h.
+
 2005-09-01  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkfilesystemunix.c: Pass statbufs down to 
index e73fdc508c38477dd8b7d31a4466224cdd542584..89dc4c85767466d930d7a31f0dfa1672c58bf1ae 100644 (file)
@@ -140,6 +140,7 @@ GPollFD event_poll_fd;
 
 static GdkWindow *current_window = NULL;
 static gint current_x, current_y;
+static gint current_root_x, current_root_y;
 static UINT msh_mousewheel;
 static UINT client_message;
 
@@ -2731,6 +2732,17 @@ gdk_event_translate (MSG  *msg,
                         msg->wParam,
                         GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
 
+      /* If we haven't moved, don't create any GDK event. Windows
+       * sends WM_MOUSEMOVE messages after a new window is shows under
+       * the mouse, even if the mouse hasn't moved. This disturbs gtk.
+       */
+      if (msg->pt.x + _gdk_offset_x == current_root_x &&
+         msg->pt.y + _gdk_offset_y == current_root_y)
+       break;
+
+      current_root_x = msg->pt.x + _gdk_offset_x;
+      current_root_y = msg->pt.y + _gdk_offset_y;
+
       assign_object (&window, find_window_for_mouse_event (window, msg));
 
       if (p_grab_window != NULL)
@@ -2757,15 +2769,6 @@ gdk_event_translate (MSG  *msg,
       if (window != orig_window)
        translate_mouse_coords (orig_window, window, msg);
 
-      /* If we haven't moved, don't create any event.
-       * Windows sends WM_MOUSEMOVE messages after button presses
-       * even if the mouse doesn't move. This disturbs gtk.
-       */
-      if (window == current_window &&
-         GET_X_LPARAM (msg->lParam) == current_x &&
-         GET_Y_LPARAM (msg->lParam) == current_y)
-       break;
-
       event = gdk_event_new (GDK_MOTION_NOTIFY);
       event->motion.window = window;
       event->motion.time = _gdk_win32_get_next_tick (msg->time);
@@ -2774,8 +2777,8 @@ gdk_event_translate (MSG  *msg,
       _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
       event->motion.x += xoffset;
       event->motion.y += yoffset;
-      event->motion.x_root = msg->pt.x + _gdk_offset_x;
-      event->motion.y_root = msg->pt.y + _gdk_offset_y;
+      event->motion.x_root = current_root_x;
+      event->motion.y_root = current_root_y;
       event->motion.axes = NULL;
       event->motion.state = build_pointer_event_state (msg);
       event->motion.is_hint = FALSE;
index 3e03c69ce92703ce733a4091d123ae383bab51ee..4b176bd9f64c8a3300d0b4523357d29e630ce654 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __GTKINTL_H__
 #define __GTKINTL_H__
 
-#include "config.h"
 #include <glib/gi18n-lib.h>
 
 #ifdef ENABLE_NLS
index 4b6271c3299b9340eae97638b969fd5bf6f3f0a5..a0403c2bcba7b02be143601cf5d4ca079c7aecbe 100644 (file)
@@ -25,6 +25,8 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
+
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
 #include "gtkplug.h"